import 'package:flutter/material.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
import 'package:flutter/cupertino.dart';
const kAndroidUserAgent = 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Mobile Safari/537.36';

class WebViewPage extends StatefulWidget {
  WebViewPage(this.url,this.title);
  final String url;
  final String title;
  @override
  WebViewPageState createState() {
    return new WebViewPageState(this.url,this.title);
  }
}

class WebViewPageState extends State<WebViewPage> {
  WebViewPageState(this.url,this.title);
  String url;
  String title;
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter WebView Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new WebviewScaffold(
        url: this.url,
        appBar: new CupertinoNavigationBar(
          leading: new CupertinoButton(
            padding: EdgeInsets.all(0.0),
            child: new Icon(
              CupertinoIcons.back,
              color: Colors.black,
            ),
            onPressed: () {
              Navigator.pop(context, null);
            },
          ),
          actionsForegroundColor: Colors.black,
          backgroundColor: Colors.white,
          middle: new Text(
            this.title,
            style: new TextStyle(
              color: Colors.black,
              fontWeight: FontWeight.normal,
            ),
          ),
        ),
      ),
    );
  }
}